<?php
class Database{
		private $server="localhost";
		private $username="root";
		private $password="063535412";
		private $dbname="qlsv-new";
		
		
		private $db;
		
		private $result;
		public $con;
		
		
		private function connect()
		{
			$this->con=mysql_connect($this->server,$this->username,$this->password) or die("Cannot connect to MySQL Server");
			$this->db=mysql_select_db($this->dbname) or die("Cannot connect to database");
			return $this->db;
		}
		
		public function query($strSQL)
		{
			if($this->con==NULL)
			{
				$this->connect();
			}
			$sql=mysql_escape_string($strSQL);
			$this->result=mysql_query($sql);
			return $this->result;
		}
		public function freeResult()
		{
			if($this->result!=NULL)
			{
				mysql_free_result($this->result);
			}
		}
	}
?>